<template>
	<view class="list-outer">
		<view class="list-item" @tap.stop="goNext" v-for="(item,index) in list" :key="index">
			<div class="title">
				实验{{index+1}}：{{item.coursetrainings_name}}
			</div>
			<div class="btn" :class="'btn'+item.trainings_status.trainings_status">
				{{item.trainings_status.trainings_status_name}}
			</div>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			course: String
		},
		data() {
			return {
				list: [],
			};
		},
		mounted() {
			this.get_course_chapterApi()
		},
		methods: {
			async get_course_chapterApi() {
				let res = await this.$api.post(global.apiUrls.post6843b550611e8, {
					courseplan_id: this.course,
				})

				if (res.data.code == 1) {
					this.list = res.data.data

					this.$emit('myEvent', this.list);
				}
			},
			goNext(val) {
				uni.showToast({
					title: '该功能请在 PC 端查看',
					duration: 1000,
					icon: 'none',
				});
			}
		}
	};
</script>

<style lang="scss" scoped>
	.list-outer {
		padding: 44rpx 24rpx 24rpx;
	}

	.list-item {
		display: flex;
		margin-bottom: 56rpx;
		justify-content: space-between;
		align-items: center;

		.title {
			width: 75%;
			font-weight: 500;
			font-size: 28rpx;
			color: #131D34;
			line-height: 40rpx;
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
		}

		.btn {
			font-weight: 400;
			font-size: 26rpx;
			color: #949AAB;
			line-height: 37rpx;
			padding: 10rpx 22rpx;
			border-radius: 28rpx 28rpx 28rpx 28rpx;
		}

		.btn1 {
			background: #DCE7FE;
			color: #145EFD;
		}

		.btn2 {
			background: #145EFD;
			color: #FFFFFF;
		}

		.btn3 {
			padding: 9rpx 21rpx;
			border: 1rpx solid #949AAB;
		}
	}
</style>